package com.atguigu.cloud.controller;

import com.atguigu.cloud.entities.Order;
import com.atguigu.cloud.resp.ResultData;
import com.atguigu.cloud.service.OrderService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author bairimengchang
 * @version 1.0
 * @project cloud2024
 * @description 订单控制器
 * @date 2024/12/9
 */
@RestController
public class OrderController {

    @Resource
    private OrderService orderService;

    // 创建订单，按标准来说应该是post请求（新增）
//    @GetMapping("/order/create")
    @PostMapping("/order/create")
    public ResultData<Order> create(@RequestBody Order order){
        orderService.create(order);
        return ResultData.success(order);
    }

}
